package org.hongqi.common.senpec.base.mybatisplus.jpa;

import org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy;
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
import org.springframework.beans.factory.annotation.Value;


public class MyNamingStrategy extends CamelCaseToUnderscoresNamingStrategy {
    @Value("${spring.application.name}")
    private String server;

    @Override
    public Identifier toPhysicalTableName(Identifier logicalName, JdbcEnvironment jdbcEnvironment) {
        return Identifier.toIdentifier(server + "_" + logicalName.toString().toLowerCase());
    }
}
